﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{   
    [Serializable]
    public class HazopTeam{
        private string name;
        private string companyName;
        private string deptName;
        private string title;
        private List<string> dateList = new List<string>();

        public HazopTeam(){
            
        }
        public HazopTeam(string name, string companyName, string deptName, string title, List<string > dateList){
            this.name = name;
            this.companyName = companyName;
            this.deptName = deptName;
            this.title = title;
            this.dateList = dateList;
        }

        public string Name{
            get { return name; }
            set { name = value; }
        }

        public string CompanyName{
            get { return companyName; }
            set { companyName = value; }
        }

        public string DeptName{
            get { return deptName; }
            set { deptName = value; }
        }

        public string Title{
            get { return title; }
            set { title = value; }
        }

        public List<string> DateList{
            get{
                return dateList;
            }
            set { dateList = value; }
        }

        public override bool Equals(object obj){
            if(obj != null && obj is HazopTeam){
                HazopTeam h = (HazopTeam) obj;
                if(this.name == h.name && this.companyName == h.companyName && this.deptName == h.deptName && this.title == h.title){
                    for (int i = 0; i < dateList.Count; i++){
                        if (dateList[i].Equals(h.dateList[i])){
                            continue;
                        }
                        else{
                            return false;
                        }
                    }
                    return true;
                }
            }
            return false;
        }
    }
}
